package org.tcp;

import java.io.IOException;
import java.util.Scanner;

/**
 * 和客户端进行互动的服务器
 */
public class TCPMsgServer extends TCPEchoServer{
    public TCPMsgServer(int port) throws IOException {
        super(port);
    }
    @Override
    protected String process(String request) {
        // 打印客户端发来的内容
        System.out.println("-> " + request);
        // 获取响应的内容
        Scanner in = new Scanner(System.in);
        request = in.nextLine();
        return request;
    }
    public static void main(String[] args) throws IOException {
        TCPMsgServer server = new TCPMsgServer(9090);
        server.start();
    }
}
